using RxjhServer.DbClss;
using System;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Windows.Forms;

namespace RxjhServer
{
	public class SendItem : Form
	{
		private Players Player;

		private Button button1;

		private Label label1;

		private Label label3;

		private TextBox textBox1;

		private Label label40;

		private Label label14;

		private ComboBox comboBox11;

		private ListBox listBox3;

		private Label label11;

		private Label label10;

		private Label label9;

		private Label label8;

		private TextBox textBox10;

		private TextBox textBox9;

		private TextBox textBox8;

		private TextBox textBox7;

		private TextBox textBox6;

		private Label label6;

		private TextBox textBox2;

		private TextBox textBox3;

		private Label label2;

		private TextBox textBox4;

		private Label label4;

		private TextBox textBox5;

		private Label label5;

		private TextBox textBox11;

		private Label label7;

		private GroupBox groupBox1;

		private GroupBox groupBox2;

		private Button button6;

		private TextBox textBox12;

		private Label label12;

		private Button button5;

		private Button button4;

		private Button button3;

		private Button button2;

		private TextBox textBox13;

		private Label label13;

		private TextBox textBox14;

		private Label label15;

		public SendItem()
		{
			InitializeComponent();
		}

		public bool SetUser(string UserName)
		{
			Player = World.检查玩家name(UserName);
			if (Player != null)
			{
				return true;
			}
			return false;
		}

		public void SetUserName(string UserName)
		{
		}

		private void SendItem_Load(object sender, EventArgs e)
		{
			Player = null;
			textBox1.Text = "1";
			textBox6.Text = "0";
			textBox7.Text = "10000015";
			textBox8.Text = "10000015";
			textBox9.Text = "10000015";
			textBox10.Text = "10000015";
			textBox14.Text = "0";
		}

		private void comboBox11_SelectedIndexChanged(object sender, EventArgs e)
		{
			string str = "";
			switch (comboBox11.Text)
			{
			case "武器":
				str = "4";
				break;
			case "衣服":
				str = "1";
				break;
			case "护手":
				str = "2";
				break;
			case "鞋子":
				str = "5";
				break;
			case "内甲":
				str = "6";
				break;
			case "项链":
				str = "7";
				break;
			case "耳环":
				str = "8";
				break;
			case "戒指":
				str = "10";
				break;
			case "披风":
				str = "12";
				break;
			case "弓箭":
				str = "13";
				break;
			case "门甲":
				str = "14";
				break;
			case "宝宝":
				str = "15";
				break;
			case "其他":
				str = "0";
				break;
			case "石头":
				str = "16";
				break;
			}
			listBox3.Items.Clear();
			string sqlCommand = "select * from TBL_物品列表 where FLD_RESIDE2='" + str + "'";
			DataTable dBToDataTable = DBA.GetDBToDataTable(sqlCommand, "PublicDb");
			for (int i = 0; i < dBToDataTable.Rows.Count; i++)
			{
				listBox3.Items.Add(dBToDataTable.Rows[i]["FLD_NAME"].ToString());
			}
			dBToDataTable.Dispose();
		}

		private void listBox3_SelectedIndexChanged(object sender, EventArgs e)
		{
			string sqlCommand = $"select * from TBL_物品列表 where FLD_NAME='{listBox3.SelectedItem}'";
			DataTable dBToDataTable = DBA.GetDBToDataTable(sqlCommand, "PublicDb");
			textBox13.Text = dBToDataTable.Rows[0]["FLD_PID"].ToString();
			dBToDataTable.Dispose();
		}

		private void button1_Click(object sender, EventArgs e)
		{
			if (string.IsNullOrEmpty(textBox2.Text))
			{
				return;
			}
			Player = World.检查玩家name(textBox2.Text);
			if (Player != null)
			{
				int num = Player.得到包裹空位(Player);
				if (num == -1)
				{
					MessageBox.Show("没有空位");
					return;
				}
				int num2 = 0;
				num2 = int.Parse(textBox14.Text);
				if (num2 != 0 && num2 != 1)
				{
					MessageBox.Show("绑定编辑 必须是1  或者 0");
					return;
				}
				Player.增加物品带属性(int.Parse(textBox13.Text), num, int.Parse(textBox1.Text), int.Parse(textBox6.Text), int.Parse(textBox7.Text), int.Parse(textBox8.Text), int.Parse(textBox9.Text), int.Parse(textBox10.Text), num2);
				MessageBox.Show("发送成功，人物:" + Player.UserName + " 物品: " + listBox3.SelectedItem?.ToString());
			}
			else
			{
				MessageBox.Show("该玩家没有在线请重新输入");
			}
		}

		private void comboBox1_SelectedIndexChanged(object sender, EventArgs e)
		{
		}

		private void button2_Click(object sender, EventArgs e)
		{
		}

		private void button2_Click_1(object sender, EventArgs e)
		{
			if (!string.IsNullOrEmpty(textBox2.Text))
			{
				Player = World.检查玩家name(textBox2.Text);
				if (Player != null)
				{
					Player.Player_ExpErience += int.Parse(textBox3.Text);
					Player.更新经验和历练();
					Player.更新金钱和负重();
					MessageBox.Show("发送成功，人物当前历练:" + Player.Player_ExpErience.ToString() + " 增加历练: " + int.Parse(textBox3.Text).ToString());
				}
				else
				{
					MessageBox.Show("该玩家没有在线请重新输入");
				}
			}
		}

		private void button3_Click(object sender, EventArgs e)
		{
			if (!string.IsNullOrEmpty(textBox2.Text))
			{
				Player = World.检查玩家name(textBox2.Text);
				if (Player != null)
				{
					Player.人物经验 += int.Parse(textBox4.Text);
					Player.计算人物基本数据3();
					Player.更新经验和历练();
					Player.更新金钱和负重();
					MessageBox.Show("发送成功，人物当前经验:" + Player.人物经验.ToString() + " 增加经验: " + int.Parse(textBox4.Text).ToString());
				}
				else
				{
					MessageBox.Show("该玩家没有在线请重新输入");
				}
			}
		}

		private void button4_Click(object sender, EventArgs e)
		{
			if (!string.IsNullOrEmpty(textBox2.Text))
			{
				Player = World.检查玩家name(textBox2.Text);
				if (Player != null)
				{
					Player.Player_Level = int.Parse(textBox5.Text);
					Player.人物经验 = 0L;
					Player.计算人物基本数据3();
					Player.更新经验和历练();
					Player.更新金钱和负重();
					MessageBox.Show("发送成功，当前等级:" + Player.Player_Level.ToString() + " 增加等级: " + int.Parse(textBox5.Text).ToString());
				}
				else
				{
					MessageBox.Show("该玩家没有在线请重新输入");
				}
			}
		}

		internal static void SetName(object nameusername)
		{
			throw new NotImplementedException();
		}

		private void button5_Click(object sender, EventArgs e)
		{
			if (!string.IsNullOrEmpty(textBox2.Text))
			{
				Player = World.检查玩家name(textBox2.Text);
				if (Player != null)
				{
					Player.Player_Money += int.Parse(textBox11.Text);
					Player.更新金钱和负重();
					MessageBox.Show("发送成功，当前金币:" + Player.Player_Money.ToString() + " 增加金币: " + int.Parse(textBox11.Text).ToString());
				}
				else
				{
					MessageBox.Show("该玩家没有在线请重新输入");
				}
			}
		}

		private void button6_Click(object sender, EventArgs e)
		{
			if (!string.IsNullOrEmpty(textBox2.Text))
			{
				Player = World.检查玩家name(textBox2.Text);
				if (Player != null)
				{
					Player.查百宝阁元宝数();
					Player.检察元宝数据(int.Parse(textBox12.Text), 1);
					Player.保存元宝数据();
					MessageBox.Show("发送成功，当前元宝:" + Player.FLD_RXPIONT.ToString() + " 增加元宝: " + int.Parse(textBox12.Text).ToString());
				}
				else
				{
					MessageBox.Show("该玩家没有在线请重新输入");
				}
			}
		}

		private void textBox8_TextChanged(object sender, EventArgs e)
		{
		}

		private void InitializeComponent()
		{
			System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(RxjhServer.SendItem));
			button1 = new System.Windows.Forms.Button();
			label1 = new System.Windows.Forms.Label();
			label3 = new System.Windows.Forms.Label();
			textBox1 = new System.Windows.Forms.TextBox();
			label40 = new System.Windows.Forms.Label();
			label14 = new System.Windows.Forms.Label();
			comboBox11 = new System.Windows.Forms.ComboBox();
			listBox3 = new System.Windows.Forms.ListBox();
			label11 = new System.Windows.Forms.Label();
			label10 = new System.Windows.Forms.Label();
			label9 = new System.Windows.Forms.Label();
			label8 = new System.Windows.Forms.Label();
			textBox10 = new System.Windows.Forms.TextBox();
			textBox9 = new System.Windows.Forms.TextBox();
			textBox8 = new System.Windows.Forms.TextBox();
			textBox7 = new System.Windows.Forms.TextBox();
			textBox6 = new System.Windows.Forms.TextBox();
			label6 = new System.Windows.Forms.Label();
			textBox2 = new System.Windows.Forms.TextBox();
			textBox3 = new System.Windows.Forms.TextBox();
			label2 = new System.Windows.Forms.Label();
			textBox4 = new System.Windows.Forms.TextBox();
			label4 = new System.Windows.Forms.Label();
			textBox5 = new System.Windows.Forms.TextBox();
			label5 = new System.Windows.Forms.Label();
			textBox11 = new System.Windows.Forms.TextBox();
			label7 = new System.Windows.Forms.Label();
			groupBox1 = new System.Windows.Forms.GroupBox();
			label15 = new System.Windows.Forms.Label();
			textBox14 = new System.Windows.Forms.TextBox();
			label13 = new System.Windows.Forms.Label();
			textBox13 = new System.Windows.Forms.TextBox();
			groupBox2 = new System.Windows.Forms.GroupBox();
			button6 = new System.Windows.Forms.Button();
			textBox12 = new System.Windows.Forms.TextBox();
			label12 = new System.Windows.Forms.Label();
			button5 = new System.Windows.Forms.Button();
			button4 = new System.Windows.Forms.Button();
			button3 = new System.Windows.Forms.Button();
			button2 = new System.Windows.Forms.Button();
			groupBox1.SuspendLayout();
			groupBox2.SuspendLayout();
			SuspendLayout();
			button1.Location = new System.Drawing.Point(172, 256);
			button1.Name = "button1";
			button1.Size = new System.Drawing.Size(166, 20);
			button1.TabIndex = 0;
			button1.Text = "发送";
			button1.UseVisualStyleBackColor = true;
			button1.Click += new System.EventHandler(button1_Click);
			label1.AutoSize = true;
			label1.Location = new System.Drawing.Point(12, 23);
			label1.Name = "label1";
			label1.Size = new System.Drawing.Size(41, 12);
			label1.TabIndex = 1;
			label1.Text = "发送给";
			label3.AutoSize = true;
			label3.Location = new System.Drawing.Point(170, 213);
			label3.Name = "label3";
			label3.Size = new System.Drawing.Size(29, 12);
			label3.TabIndex = 5;
			label3.Text = "数量";
			textBox1.Location = new System.Drawing.Point(211, 206);
			textBox1.Name = "textBox1";
			textBox1.Size = new System.Drawing.Size(44, 21);
			textBox1.TabIndex = 6;
			textBox1.Text = "1";
			label40.AutoSize = true;
			label40.Location = new System.Drawing.Point(30, 17);
			label40.Name = "label40";
			label40.Size = new System.Drawing.Size(101, 12);
			label40.TabIndex = 39;
			label40.Text = "物品代码搜索列表";
			label14.AutoSize = true;
			label14.Location = new System.Drawing.Point(31, 236);
			label14.Name = "label14";
			label14.Size = new System.Drawing.Size(65, 12);
			label14.TabIndex = 42;
			label14.Text = "物品代码ID";
			comboBox11.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList;
			comboBox11.FormattingEnabled = true;
			comboBox11.Items.AddRange(new object[14]
			{
				"衣服",
				"护手",
				"鞋子",
				"武器",
				"内甲",
				"耳环",
				"项链",
				"戒指",
				"披风",
				"门甲",
				"宝宝",
				"弓箭",
				"石头",
				"其他"
			});
			comboBox11.Location = new System.Drawing.Point(32, 40);
			comboBox11.MaxDropDownItems = 20;
			comboBox11.Name = "comboBox11";
			comboBox11.Size = new System.Drawing.Size(121, 20);
			comboBox11.TabIndex = 40;
			comboBox11.SelectedIndexChanged += new System.EventHandler(comboBox11_SelectedIndexChanged);
			listBox3.FormattingEnabled = true;
			listBox3.ItemHeight = 12;
			listBox3.Location = new System.Drawing.Point(32, 66);
			listBox3.Name = "listBox3";
			listBox3.Size = new System.Drawing.Size(121, 160);
			listBox3.TabIndex = 38;
			listBox3.SelectedIndexChanged += new System.EventHandler(listBox3_SelectedIndexChanged);
			label11.AutoSize = true;
			label11.Location = new System.Drawing.Point(170, 183);
			label11.Name = "label11";
			label11.Size = new System.Drawing.Size(35, 12);
			label11.TabIndex = 52;
			label11.Text = "属性5";
			label10.AutoSize = true;
			label10.Location = new System.Drawing.Point(170, 156);
			label10.Name = "label10";
			label10.Size = new System.Drawing.Size(35, 12);
			label10.TabIndex = 51;
			label10.Text = "属性4";
			label9.AutoSize = true;
			label9.Location = new System.Drawing.Point(170, 129);
			label9.Name = "label9";
			label9.Size = new System.Drawing.Size(35, 12);
			label9.TabIndex = 50;
			label9.Text = "属性3";
			label8.AutoSize = true;
			label8.Location = new System.Drawing.Point(170, 102);
			label8.Name = "label8";
			label8.Size = new System.Drawing.Size(35, 12);
			label8.TabIndex = 49;
			label8.Text = "属性2";
			textBox10.Location = new System.Drawing.Point(211, 180);
			textBox10.Name = "textBox10";
			textBox10.Size = new System.Drawing.Size(129, 21);
			textBox10.TabIndex = 48;
			textBox10.Text = "10000015";
			textBox9.Location = new System.Drawing.Point(211, 153);
			textBox9.Name = "textBox9";
			textBox9.Size = new System.Drawing.Size(129, 21);
			textBox9.TabIndex = 47;
			textBox9.Text = "10000015";
			textBox8.Location = new System.Drawing.Point(211, 126);
			textBox8.Name = "textBox8";
			textBox8.Size = new System.Drawing.Size(129, 21);
			textBox8.TabIndex = 46;
			textBox8.Text = "10000015";
			textBox8.TextChanged += new System.EventHandler(textBox8_TextChanged);
			textBox7.Location = new System.Drawing.Point(211, 99);
			textBox7.Name = "textBox7";
			textBox7.Size = new System.Drawing.Size(129, 21);
			textBox7.TabIndex = 45;
			textBox7.Text = "10000015";
			textBox6.Location = new System.Drawing.Point(211, 72);
			textBox6.Name = "textBox6";
			textBox6.Size = new System.Drawing.Size(129, 21);
			textBox6.TabIndex = 44;
			textBox6.Text = "0";
			label6.AutoSize = true;
			label6.Location = new System.Drawing.Point(170, 75);
			label6.Name = "label6";
			label6.Size = new System.Drawing.Size(35, 12);
			label6.TabIndex = 43;
			label6.Text = "属性1";
			textBox2.Location = new System.Drawing.Point(59, 20);
			textBox2.Name = "textBox2";
			textBox2.Size = new System.Drawing.Size(129, 21);
			textBox2.TabIndex = 53;
			textBox2.TextChanged += new System.EventHandler(textBox2_TextChanged);
			textBox3.Location = new System.Drawing.Point(62, 26);
			textBox3.Name = "textBox3";
			textBox3.Size = new System.Drawing.Size(129, 21);
			textBox3.TabIndex = 55;
			label2.AutoSize = true;
			label2.Location = new System.Drawing.Point(21, 29);
			label2.Name = "label2";
			label2.Size = new System.Drawing.Size(29, 12);
			label2.TabIndex = 54;
			label2.Text = "历练";
			textBox4.Location = new System.Drawing.Point(62, 62);
			textBox4.Name = "textBox4";
			textBox4.Size = new System.Drawing.Size(129, 21);
			textBox4.TabIndex = 57;
			label4.AutoSize = true;
			label4.Location = new System.Drawing.Point(21, 65);
			label4.Name = "label4";
			label4.Size = new System.Drawing.Size(29, 12);
			label4.TabIndex = 56;
			label4.Text = "经验";
			textBox5.Location = new System.Drawing.Point(62, 104);
			textBox5.Name = "textBox5";
			textBox5.Size = new System.Drawing.Size(129, 21);
			textBox5.TabIndex = 59;
			label5.AutoSize = true;
			label5.Location = new System.Drawing.Point(21, 111);
			label5.Name = "label5";
			label5.Size = new System.Drawing.Size(29, 12);
			label5.TabIndex = 58;
			label5.Text = "等级";
			textBox11.Location = new System.Drawing.Point(62, 143);
			textBox11.Name = "textBox11";
			textBox11.Size = new System.Drawing.Size(129, 21);
			textBox11.TabIndex = 61;
			label7.AutoSize = true;
			label7.Location = new System.Drawing.Point(21, 146);
			label7.Name = "label7";
			label7.Size = new System.Drawing.Size(29, 12);
			label7.TabIndex = 60;
			label7.Text = "金币";
			groupBox1.Controls.Add(label15);
			groupBox1.Controls.Add(textBox14);
			groupBox1.Controls.Add(label13);
			groupBox1.Controls.Add(textBox13);
			groupBox1.Controls.Add(label40);
			groupBox1.Controls.Add(button1);
			groupBox1.Controls.Add(label3);
			groupBox1.Controls.Add(textBox1);
			groupBox1.Controls.Add(listBox3);
			groupBox1.Controls.Add(comboBox11);
			groupBox1.Controls.Add(label14);
			groupBox1.Controls.Add(label6);
			groupBox1.Controls.Add(textBox6);
			groupBox1.Controls.Add(label11);
			groupBox1.Controls.Add(textBox7);
			groupBox1.Controls.Add(label10);
			groupBox1.Controls.Add(textBox8);
			groupBox1.Controls.Add(label9);
			groupBox1.Controls.Add(textBox9);
			groupBox1.Controls.Add(label8);
			groupBox1.Controls.Add(textBox10);
			groupBox1.Location = new System.Drawing.Point(14, 63);
			groupBox1.Name = "groupBox1";
			groupBox1.Size = new System.Drawing.Size(355, 301);
			groupBox1.TabIndex = 62;
			groupBox1.TabStop = false;
			groupBox1.Text = "刷装备";
			label15.AutoSize = true;
			label15.ForeColor = System.Drawing.Color.Red;
			label15.Location = new System.Drawing.Point(260, 236);
			label15.Name = "label15";
			label15.RightToLeft = System.Windows.Forms.RightToLeft.No;
			label15.Size = new System.Drawing.Size(83, 12);
			label15.TabIndex = 71;
			label15.Text = "1绑定 0不绑定";
			textBox14.Location = new System.Drawing.Point(211, 233);
			textBox14.Name = "textBox14";
			textBox14.Size = new System.Drawing.Size(44, 21);
			textBox14.TabIndex = 70;
			textBox14.Text = "0";
			label13.AutoSize = true;
			label13.Location = new System.Drawing.Point(170, 236);
			label13.Name = "label13";
			label13.Size = new System.Drawing.Size(29, 12);
			label13.TabIndex = 69;
			label13.Text = "绑定";
			textBox13.Location = new System.Drawing.Point(32, 256);
			textBox13.Name = "textBox13";
			textBox13.Size = new System.Drawing.Size(121, 21);
			textBox13.TabIndex = 68;
			groupBox2.Controls.Add(button6);
			groupBox2.Controls.Add(textBox12);
			groupBox2.Controls.Add(label12);
			groupBox2.Controls.Add(button5);
			groupBox2.Controls.Add(button4);
			groupBox2.Controls.Add(button3);
			groupBox2.Controls.Add(button2);
			groupBox2.Controls.Add(label2);
			groupBox2.Controls.Add(textBox3);
			groupBox2.Controls.Add(textBox11);
			groupBox2.Controls.Add(label4);
			groupBox2.Controls.Add(label7);
			groupBox2.Controls.Add(textBox4);
			groupBox2.Controls.Add(textBox5);
			groupBox2.Controls.Add(label5);
			groupBox2.Location = new System.Drawing.Point(393, 63);
			groupBox2.Name = "groupBox2";
			groupBox2.Size = new System.Drawing.Size(320, 301);
			groupBox2.TabIndex = 63;
			groupBox2.TabStop = false;
			groupBox2.Text = "其他操作";
			button6.Location = new System.Drawing.Point(225, 178);
			button6.Name = "button6";
			button6.Size = new System.Drawing.Size(82, 29);
			button6.TabIndex = 67;
			button6.Text = "发送";
			button6.UseVisualStyleBackColor = true;
			button6.Click += new System.EventHandler(button6_Click);
			textBox12.Location = new System.Drawing.Point(62, 183);
			textBox12.Name = "textBox12";
			textBox12.Size = new System.Drawing.Size(129, 21);
			textBox12.TabIndex = 66;
			label12.AutoSize = true;
			label12.Location = new System.Drawing.Point(21, 186);
			label12.Name = "label12";
			label12.Size = new System.Drawing.Size(29, 12);
			label12.TabIndex = 65;
			label12.Text = "元宝";
			button5.Location = new System.Drawing.Point(225, 138);
			button5.Name = "button5";
			button5.Size = new System.Drawing.Size(82, 29);
			button5.TabIndex = 64;
			button5.Text = "发送";
			button5.UseVisualStyleBackColor = true;
			button5.Click += new System.EventHandler(button5_Click);
			button4.Location = new System.Drawing.Point(225, 99);
			button4.Name = "button4";
			button4.Size = new System.Drawing.Size(82, 29);
			button4.TabIndex = 63;
			button4.Text = "发送";
			button4.UseVisualStyleBackColor = true;
			button4.Click += new System.EventHandler(button4_Click);
			button3.Location = new System.Drawing.Point(225, 58);
			button3.Name = "button3";
			button3.Size = new System.Drawing.Size(82, 29);
			button3.TabIndex = 62;
			button3.Text = "发送";
			button3.UseVisualStyleBackColor = true;
			button3.Click += new System.EventHandler(button3_Click);
			button2.Location = new System.Drawing.Point(225, 21);
			button2.Name = "button2";
			button2.Size = new System.Drawing.Size(82, 29);
			button2.TabIndex = 53;
			button2.Text = "发送";
			button2.UseVisualStyleBackColor = true;
			button2.Click += new System.EventHandler(button2_Click_1);
			base.AutoScaleDimensions = new System.Drawing.SizeF(6f, 12f);
			base.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
			base.ClientSize = new System.Drawing.Size(728, 385);
			base.Controls.Add(groupBox2);
			base.Controls.Add(groupBox1);
			base.Controls.Add(textBox2);
			base.Controls.Add(label1);
			base.Icon = (System.Drawing.Icon)resources.GetObject("$this.Icon");
			base.MaximizeBox = false;
			base.MinimizeBox = false;
			base.Name = "SendItem";
			Text = "发送物品";
			base.Load += new System.EventHandler(SendItem_Load);
			groupBox1.ResumeLayout(false);
			groupBox1.PerformLayout();
			groupBox2.ResumeLayout(false);
			groupBox2.PerformLayout();
			ResumeLayout(false);
			PerformLayout();
		}

		private void textBox2_TextChanged(object sender, EventArgs e)
		{
		}
	}
}
